package com.joe.learn.jvm;

import java.io.IOException;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

public class JobB {


    public static void main(String[] args) {

        long start = System.currentTimeMillis();
        BlockingQueue workQueue = new ArrayBlockingQueue<Runnable>(10);
        ThreadPoolExecutor poolExecutor = new ThreadPoolExecutor(30, 1000, 1000, TimeUnit.SECONDS, workQueue);

        for (int i = 1; i <= 500; i++) {
            JobTask task = new JobBTask(String.valueOf(i));
            poolExecutor.execute(task);
        }
//        JobTask task = new JobBTask("jobB");
//        int j = 0;
//        for (int i = 1; i <= 500; i++) {
//            ((JobBTask) task).m1(j++, "jobB");
//            ((JobBTask) task).m2(j++, "jobB");
//            ((JobBTask) task).m3(j++, "jobB");
//            ((JobBTask) task).m4(j++, "jobB");
//        }
        System.out.println("JobB Time:" + (System.currentTimeMillis() - start));
        poolExecutor.shutdown();

    }

}
